package com.rlz.framemm.ui.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.rlz.base.base.BaseHolder
import com.rlz.base.tools.adapter.BaseAdapter
import com.rlz.framemm.R
import com.rlz.framemm.databinding.ItemRecyclerBinding

/**
 * Created by RLZ
 * on 2021/11/10
 *
 */
class BehaviorAdapter : BaseAdapter<String>() {
    override fun getViewHolder(viewGroup: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
        val binding: ItemRecyclerBinding = DataBindingUtil.inflate(
            LayoutInflater.from(viewGroup!!.context),
            R.layout.item_recycler,
            viewGroup,
            false
        )
        return BaseHolder(binding)
    }

    override fun onBindHolder(viewHolder: RecyclerView.ViewHolder?, position: Int) {
        val binding: ItemRecyclerBinding? = DataBindingUtil.getBinding(viewHolder!!.itemView)
        binding?.tv?.text = mData[position]
    }
}